Skip to content

fix(prometheus): handle plain text response in Prometheus connection test#559

Merged
illume merged 1 commit intoheadlamp-k8s:mainfrom
wingerx:main
Mar 20, 2026
Merged

fix(prometheus): handle plain text response in Prometheus connection test#559
illume merged 1 commit intoheadlamp-k8s:mainfrom
wingerx:main

Conversation

@wingerx
Copy link
Contributor

@wingerx wingerx commented Mar 18, 2026

In the Prometheus plugin settings page, after manually configuring the Prometheus Service Address and clicking Test Connection, the frontend calls the Prometheus /-/healthy endpoint. That endpoint returns plain text, such as 'Prometheus Server is Healthy'.but the current implementation handles the response using the default JSON parsing path. As a result, the frontend throws Unexpected token 'P' during parsing and incorrectly reports the connection as failed.

This fix updates the connection test logic to handle the response as a raw HTTP response instead of forcing JSON parsing, and determines success based on the HTTP status code. This makes the test compatible with Prometheus health check endpoints that return plain text.

Signed-off-by: jackey.zhang <jackey.zhang@woqutech.com>
Copy link
Contributor

@illume illume left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 thanks!

@illume illume merged commit f02924d into headlamp-k8s:main Mar 20, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants